import OpenAI from "openai";
import fs from "fs";

const openai = new OpenAI({
  //   baseURL: "https://api.deepseek.com",
  baseURL: "http://127.0.0.1:8000/v1",
  apiKey: "EJ3NRODNPG3KkbVtjSHjz5QXHT/HdUaLbUvvYEwqXOIxKTwpOJwCPxx217TiXNCP",
});

async function main() {
  // console.log(completion.choices[0].message.content);

  // await openai.files.create({
  //   file: fs.createReadStream("input.json"),
  //   purpose: "fine-tune",
  // });

  // 上传文件
  const file = await openai.files.create({
    file: fs.createReadStream("input.json"),
    purpose: "translations", // 指定文件用途为翻译
  });

  console.log("File uploaded successfully:", file);

  const completion = await openai.chat.completions.create({
    messages: [{ role: "system", content: "You are a helpful assistant." }],
    model: "deepseek-chat",
  });
}

main();
